$(function(){
    var markers = [], map = $('#map').gmap3({
        action: 'init',
        options: {
            center: _map.center,
            zoom: 6
        }
    });
    
    for (var e in _map.pings) {
        if (e) {
            addOpenMarker(map, _map.pings[e].latlng[0], _map.pings[e].latlng[1], _map.pings[e].data, 
                getMarkerImage('markers/image03.png',36,53), getMarkerImage('markers/shadow.png',66,53));
        } else {
            addCloseMarker(map, _map.pings[e].latlng[0], _map.pings[e].latlng[1], _map.pings[e].data, 
                getMarkerImage('markers/image03.png',36,53), getMarkerImage('markers/shadow.png',66,53));
        }
    }
    
    markers = map.gmap3({
        action:'get', 
        name:'marker', 
        all:true
    });

    for (var e in _map.pings) {
        $('#map-'+(parseInt(e)+1)).bind('click',parseInt(e), function(i){
            google.maps.event.trigger(markers[i.data], 'click');
            
        });
    }
});